﻿#region Header

/*
Remote views based on linq
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Policy;

#endregion

namespace InterLinq.Test {
	/// <summary>
	/// Helper class for creating wpf windows within a unit test
	/// </summary>	
	public class WPFTestHelper {
		#region Test Methods

		/// <summary>
		/// Runs a test that has to be executed within a wpf application 
		/// </summary>
		/// <param name="toRun">code to execute</param>
		public static void RunTest(CrossAppDomainDelegate toRun) {
			var toRemeber = new List<Type>();
			//	toRemeber.Add(typeof(TestSumByOrderPositionsView));

			foreach (Type t in toRemeber) {
				Console.Write(t.Name);
			}
			// Set up the AppDomainSetup
			var setup = new AppDomainSetup();
			setup.ApplicationBase = Directory.GetCurrentDirectory();

			AppDomain domain = AppDomain.CreateDomain("UI", new Evidence(AppDomain.CurrentDomain.Evidence), setup);
			domain.DoCallBack(toRun);
		}

		#endregion
	}
}